package cn.com.db.service;

import cn.com.db.model.Surface;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class SurfaceService extends BaseService {

    public Boolean isExist(String id){
        if (StringUtils.isBlank(id)){
            return false;
        }
        return getSurfaceById(id)!=null;
    }

    public Surface getSurfaceById(String id){
        return surfaceDao.getSurfaceById(id);
    }

    public void createSurface(Surface surface){
        surfaceDao.createSurface(surface);
    }

    public List<Surface> getSurface(String parent){
        return surfaceDao.getSurface(parent);
    }

    public Integer countSurface(String parent){
        return surfaceDao.countSurface(parent);
    }

    @Transactional
    public void updateSurface(Surface surface){
        surfaceDao.update(surface);
    }


}
